/* 
 * File:   TurnThresholdKnockingStrategy.h
 * Author: root
 *
 * Created on December 6, 2008, 12:38 PM
 */

#ifndef _TURNTHRESHOLDKNOCKINGSTRATEGY_H
#define	_TURNTHRESHOLDKNOCKINGSTRATEGY_H

#include "KnockingStrategy.h"

class TurnThresholdKnockingStrategy : public KnockingStrategy {
    
    int decisionCertainty;
    int turnThreshold;
    
protected:
    
    virtual void setExecutionParameter(int index, int rangeFraction) {
        // The execution parameter is the turn threshold
        turnThreshold = 1 + (21*rangeFraction)/100;
    }

public:
    
    TurnThresholdKnockingStrategy() 
    : KnockingStrategy(string("TurnThresholdKnockingStrategy"), 1), decisionCertainty(0), turnThreshold(22) {}
    
    TurnThresholdKnockingStrategy(int myWeight)
    : KnockingStrategy(myWeight), decisionCertainty(0), turnThreshold(30)
    {
    }
                
    virtual int getDecisionCertainty() {
//        return (100 * currentHandValue) / 28;  // Where the value ranks in the range of hand values
        return decisionCertainty;
    }

    virtual Strategy* getActiveInstance(int inst_weight) {
        return dynamic_cast<Strategy*>(new TurnThresholdKnockingStrategy(inst_weight));
    }
    
    virtual void opponentMove(int opponent, const Move& move) {}
    virtual bool decideKnock(CCardStack*, const GameState*);

};

#endif	/* _TURNTHRESHOLDKNOCKINGSTRATEGY_H */

